package com.itheima.drools.service;

import org.kie.api.KieBase;
import org.kie.api.runtime.KieSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RuleService {

//    原始加载方式
//    @Autowired
//    private KieBase kieBase;
//    public void rule(){
//        KieSession kieSession = kieBase.newKieSession();
//        kieSession.fireAllRules();
//        kieSession.dispose();
//    }

//    数据库加载方式
    public void rule() {
        KieSession kieSession = ReloadDroolsRulesService.kieContainer.newKieSession();
        kieSession.fireAllRules();
        kieSession.dispose();
    }
}
